#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int main()
{
	//运算符：
	//1.算数运算符:用于处理四则运算
	// + - * / 加减乘除
	int a1 = 10;
	int b1 = 3;
	cout << a1 + b1 << endl;
	cout << a1 - b1 << endl;
	cout << a1 * b1 << endl;
	cout << a1 / b1 << endl;//两个整数相除结果保留整数部位
	//两个小数也可以相除，注意除数不能为0
	double a2 = 0.5;
	double b2 = 0.23;
	cout << a2 / b2 << endl;


	//取模（取余）：%   10%3=1
	//取模运算的本质就是用除法求余数，所以除数不能为0
	//两个小数不能做取模运算
	int a3 = 10;
	int b3 = 3;
	cout << a3 % b3 << endl;
	cout << b3 % a3 << endl;


	//递增预算符:++
	//前置递增:先让变量+1 然后进行表达式的运算
	int a4 = 10;
	++a4;//让变量+1
	cout <<"a4="<< a4 << endl;

	int a5 = 10;
	int b5 = ++a5*10;
	cout << "a5=" << a5 << "b5=" << b5 << endl;

	//后置递增:先进行表达式的运算,后让变量+1
	int a6 = 10;
	a6++;//让变量+1
	cout <<"a6="<< a6 << endl;

	int a7 = 10;
	int b7 = a7++*10;
	cout << "a7=" << a7 << "b7=" << b7 << endl;
	//递减运算符同上

	




	//赋值运算符：用于将表达式的值附给变量
	//赋值:= 不做介绍
	//加等于:+=
	int c1 = 3;
	c1 += 4;
	cout << "c1=" << c1 << endl;
	
	//减等于:-=
	c1 = 2;
	c1 -= 3;
	cout << "c1=" << c1 << endl;

	//乘等于:*=
	c1 = 3;
	c1 *= 5;
	cout << "c1=" << c1 << endl;

	//除等于:/=
	c1 = 6;
	c1 /= 2;
	cout << "c1=" << c1 << endl;

	//模等于:%=
	c1 = 7;
	c1 %= 5;
	cout << "c1=" << c1 << endl;


	//比较运算符:用于表达式的比较,并返回一个真值或者假值
	//相等于:==
	int d1 = 10;
	int d2 = 20;
	cout << (d1 == d2) << endl;//0
	//由于有优先级的比较，所以要加小括号来让比较过程优先
	
	//不等于:!=
	cout << (d1 != d2) << endl;//1

	//大于: >
	cout << (d1 > d2) << endl;//0

	//小于: <
	cout << (d1 < d2) << endl;//1

	//大于等于: >=
	cout << (d1 >= d2) << endl;//0

	//小于等于:<=
	cout << (d1 <= d2) << endl;//1



	//逻辑运算符:用于根据表达式的返回真值或假值



	system("pause");
	return 0;
}
